Skip to content

[internal/hcs] Migrate package from HCS V1 to V2#2735

Open
rawahars wants to merge 1 commit into
microsoft:mainfrom
rawahars:migrate_hcs_v1_v2
Open

[internal/hcs] Migrate package from HCS V1 to V2#2735
rawahars wants to merge 1 commit into
microsoft:mainfrom
rawahars:migrate_hcs_v1_v2

Conversation

@rawahars
Copy link
Copy Markdown
Contributor

Presently, we were using HCS V1 (vmcompute) within internal/hcs but it has been deprecated and therefore, we are moving to use computecore within hcs package.

@rawahars rawahars force-pushed the migrate_hcs_v1_v2 branch 15 times, most recently from 54b7a44 to d3f62f2 Compare May 17, 2026 19:39
@rawahars rawahars force-pushed the migrate_hcs_v1_v2 branch 3 times, most recently from adb6ee4 to c399db9 Compare May 19, 2026 11:24
Presently, we were using HCS V1 (vmcompute) within internal/hcs but it has been deprecated and therefore, we are moving to use computecore within hcs package.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars rawahars force-pushed the migrate_hcs_v1_v2 branch from c399db9 to e76ebeb Compare May 19, 2026 17:22
@rawahars rawahars marked this pull request as ready for review May 19, 2026 17:23
@rawahars rawahars requested a review from a team as a code owner May 19, 2026 17:23
Copy link
Copy Markdown
Contributor

@helsaawy helsaawy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change will cause the shim to always block on all operations, right? do we have any perf numbers on how much impact this will have?

closeOnce sync.Once
exited chan struct{}
closed chan struct{}
raw string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be cleaner to use:

Suggested change
raw string
raw json.RawMessage

Comment thread internal/hcs/operation.go
// owns the operation handle leads to use-after-free crashes
// (EXCEPTION_ACCESS_VIOLATION) inside computecore.dll. Callers must not
// rely on ctx to bound the call's duration.
func runOperation(ctx context.Context, fn func(op computecore.HcsOperation) error) (resultDoc string, err error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always end up calling processHcsResult on the operation result; ie:

	resultJSON, err := runOperation(ctx, func(op computecore.HcsOperation) error { /* ... */ })
	if err != nil {
		return nil, makeSystemError(computeSystem, operation, err, processHcsResult(ctx, resultJSON))
	}

can we elevate hcsResult to an error type (since it already (sorta) matches the ResultError API type), and then move the processHcsResult logic into run[Process]Operation?
that would reduce a lot of boilerplate

Comment thread internal/hcs/system.go
id := registerNotificationContext(computeSystem.id, 0, computeSystem.notify, computeSystem.migrationNotifyCh)
if err := computecore.HcsSetComputeSystemCallback(
ctx, computeSystem.handle,
computecore.HcsEventOptionEnableOperationCallbacks|computecore.HcsEventOptionEnableLiveMigrationEvents,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notificationHandler doesn't actually handle the operation events (and we don't keep track of the actively running operations anywhere), so it the HcsEventOptionEnableOperationCallbacks flag needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants